package com.benyi.util;

import java.util.ArrayList;

public class MySheet {
	private String name;
	private String []title;
	private ArrayList<String[]> body;
	
	public MySheet(){
		body=new ArrayList<String[]>(); 
	}
	
	public void setName(String n){
		name=n;
	}
	
	public String getName(){
		return name;
	}
	
	public void setTitle(String []t){
		title=t;
	}
	
	public void addRow(String []row){
		body.add(row);
	}
	
	public String[] getTitle(){
		return title;
	}
	
	public int size(){
		return body.size();
	}
	
	public String[] getRow(int r){
		return body.get(r);
	}
	
	public String get(int r,String key){
		if(title==null || key==null){
			return null;
		}
		String []v=getRow(r);
		for(int i=0;i<title.length;i++){
			if(key.equalsIgnoreCase(title[i])){
				return v[i];
			}
		}
		return null;
	}
}
